/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sandbox.org.wads.elements;

import org.enhydra.shark.utilities.SequencedHashMap;
import org.enhydra.shark.xpdl.XMLAttribute;
import org.enhydra.shark.xpdl.XMLComplexElement;
//import org.enhydra.shark.xpdl.elements.Namespaces;

/**
 *
 * @author Nattasan W.
 */
public class Wads extends XMLComplexElement {
  //protected Namespaces namespaces;
  protected String internalVersion;
  
  protected SequencedHashMap extPkgRefsToIds = new SequencedHashMap();
  
  public Wads() {
    super(null, true);
    //namespaces = new Namespaces(this);
    internalVersion="-1";
  }

  @Override
  protected void fillStructure() {
    XMLAttribute attrId = new XMLAttribute(this, "Id", true); //required
    XMLAttribute attrName = new XMLAttribute(this, "Name", false);
    WadsHeader refWadsHeader = new WadsHeader(this);
    RequestDetails refRequestDetails = new RequestDetails(this);
    Approvals refApprovals = new Approvals(this);
    
    add(attrId);
    add(attrName);
    add(refWadsHeader);
    add(refRequestDetails);
    add(refApprovals);
  }
  
  public String getInternalVersion() {
    return internalVersion;
  }
  
  public void setInternalVersion(String internalVersion) {
    this.internalVersion = internalVersion;
  }
  
  public String getId() {
    return get("Id").toValue();
  }
  
  public void setId(String id) {
    set("Id", id);
  }
  
  public String getName() {
    return get("Name").toValue();
  }
  
  public void setName(String name) {
    set("Name", name);
  }
  
  public WadsHeader getWadsHeader() {
    return (WadsHeader)get("WadsHeader");
  }
  
  public RequestDetails getRequestDetails() {
    return (RequestDetails)get("RequestDetails");
  }
  
  public Approvals getApprovals() {
    return (Approvals)get("Approvals");
  }
  
  @Override
  public Object clone() {
    Wads w = (Wads)super.clone();
    w.clearCaches();
    if(w.isReadOnly)
      w.initCaches();
    
    return w;
  }
  
  @Override
  public boolean equals(Object e) {
    if(!(e instanceof Wads)) {
      return false;
    }
    
    if(this.equals(e)) {
      return true;
    }
    
    return false;
  }

}
